<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            margin: 100px;
            position: relative;
        }

        .con {
            position: relative;
            width: 165px;
            height: 25px;
            border: 1px solid #333;
            font-size: 20px;
            box-shadow: 1px 1px 5px #000;
            display: none;
        }

        .con::before {
            content: '';
            width: 0;
            height: 0;
            position: absolute;
            top: 25px;
            left: 18px;
            border: 8px solid #000;
            border-style: solid dashed dashed;
            border-color: #fff transparent transparent;
        }

        .jd {
            position: absolute;
            top: 35px;
        }

        .block {
            display: block;
        }
    </style>
</head>

<body>
    <div class="box">
        <div class="con"></div>
        <input type="text" placeholder="请输入你的快递号码" class="jd">
    </div>
    <script>
        var li = document.querySelector('.con')
        var jd_input = document.querySelector('.jd');
        jd_input.addEventListener('keyup', function () {
            if (this.value == '') {
                li.style.display = 'none';
            } else {
                // li.className = 'con block';
                li.style.display = 'block';
                li.innerHTML = this.value;
            }
        })
        jd_input.addEventListener('blur', function () {
            li.style.display = 'none';
        })
        jd_input.addEventListener('focus',function(){
            if (this.value !=='') {
                li.style.display = 'block';
            }
            
        })
    </script>
</body>

</html>